package com.example.mapping.entity;

import com.example.mapping.enumeration.MappingSpecEnum;
import com.example.mapping.enumeration.VisitorTypeEnum;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.collect.Lists;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * json映射规范
 *
 * @author baoyoujia
 * @date 2022/10/17
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class JsonMappingSpec extends StandardMappingSpec {

    /**
     * 映射类型
     *
     * @see MappingSpecEnum
     */
    private Integer type;

    /**
     * 映射路径   a.b.c
     */
    private String mappingAbsolute;

    public String getName() {
        return VisitorTypeEnum.TRAVERSE.getType().equals(type) ? getSrc() : getMappingAbsolute();
    }
}
